package com.qsl.ssyx.client.product;

import com.qsl.ssyx.model.product.Category;
import com.qsl.ssyx.model.product.SkuInfo;
import com.qsl.ssyx.vo.product.SkuInfoVo;
import com.qsl.ssyx.vo.product.SkuStockLockVo;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

// 服务调用
@FeignClient(value = "service-product")
public interface ProductFeignClient {


    @ApiOperation("根据分类Id获取分类信息")
    @GetMapping("api/product/getCategory/{categoryId}")
    Category getCategory(@ApiParam(value = "分类Id", required = true) @PathVariable Long categoryId);

    @ApiOperation("根据skuId获取分类信息")
    @GetMapping("api/product/getSkuInfo/{skuId}")
    SkuInfo getSkuInfo(@ApiParam(value = "skuId", required = true) @PathVariable Long skuId);


    @ApiOperation("根据skuId获取商品信息列表")
    @GetMapping("api/product/getSkuInfoList/{skuId}")
    List<SkuInfo> getSkuInfoList(@ApiParam(value = "skuId", required = true) @PathVariable Long skuId);

    @ApiOperation("根据商品名称 查询SkuInfo集合")
    @GetMapping("api/product/getSkuInfosBySkuName/{skuName}")
    List<SkuInfo> getSkuInfosBySkuName(@ApiParam(value = "skuName", required = true) @PathVariable String skuName);

    @ApiOperation("根据分类Ids获取分类信息集合")
    @GetMapping("api/product/getCategoryList/{categoryIds}")
    List<Category> getCategoryList(@ApiParam(value = "分类Id", required = true) @PathVariable List<Long> categoryIds);


    @ApiOperation("获取所有新人专享商品")
    @GetMapping("api/product/findNewPersionSkuInfoList")
    List<SkuInfo> findNewPersionSkuInfoList();

    @ApiOperation("获取所有商品分类")
    @GetMapping("api/product/findCategoryList")
    List<Category> findCategoryList();

    @ApiOperation("根据商品id获取商品信息") // 4表连接sku_info 和sku_image-sku图片 和attr-商品属性和 sku_poster-海报表
    @GetMapping("api/product/getSKuInfoVoBySkuId/{skuId}")
    public SkuInfoVo getSKuInfoVoBySkuId(@ApiParam(value = "商品Id", required = true) @PathVariable Long skuId);


    @ApiOperation("公平锁锁定商品")
    @PostMapping("api/product/inner/checkAndLock/{orderNo}")
    public Boolean checkAndLock(@RequestBody List<SkuStockLockVo> skuStockLockVoList,
                                @ApiParam(value = "商品唯一Id", required = true) @PathVariable String orderNo);
}
